package com.ruoyi.admin.controller;
import com.ruoyi.admin.service.ResourcesService;
import com.ruoyi.app.domain.PictureInfo;
import com.ruoyi.app.domain.VideoInfo;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;

/*
@description:资源维护
@ClassName ResourcesController
@author chen
@create 2025-03-13 23:10
@Version 1.0
*/
@Slf4j
@RestController
@RequestMapping("resources")
@AllArgsConstructor
public class ResourcesController extends BaseController
{
    final ResourcesService resourcesService;

    /*
     * @==============History===============<br/>
     * @Description //   上传视频信息
     * @Date 2025-3-13 23:30
     * @Author < a href="15991488967@163.com">chen</ a>
     * @return com.ruoyi.framework.web.domain.AjaxResult
     */
    @PostMapping(value = "/insertVideoInfo",produces = "application/json;charset=utf-8")
    public AjaxResult insertVideoInfo(@RequestBody VideoInfo videoInfo)
    {
        return resourcesService.insertVideoInfo(videoInfo);
    }


    /*
     * @==============History===============<br/>
     * @Description //   更新视频信息
     * @Date 2025-3-13 23:31
     * @Author < a href="15991488967@163.com">chen</ a>
     * @return com.ruoyi.framework.web.domain.AjaxResult
     */
    @PostMapping(value = "/updateVideoInfo",produces = "application/json;charset=utf-8")
    public AjaxResult updateVideoInfo(@RequestBody VideoInfo videoInfo)
    {
        return resourcesService.updateVideoInfo(videoInfo);
    }


    /*
     * @==============History===============<br/>
     * @Description //   获取视频列表
     * @Date 2025-3-13 23:45
     * @Author < a href="15991488967@163.com">chen</ a>
     * @return com.ruoyi.framework.web.page.TableDataInfo
     */
    @GetMapping(value = "/getVideoList",produces = "application/json;charset=utf-8")
    public TableDataInfo getVideoList(@RequestParam Map<String, Object> params)
    {
        startPage();
        List<VideoInfo> list = resourcesService.getVideoList(params);
        return getDataTable(list);
    }



    /*
     * @==============History===============<br/>;
     * @Description //   新增首页图片资源信息
     * @Date 2025/3/14
     * @Author < a href="chencheng@prmt.net">chen</ a>;
     */
    @PostMapping(value = "/insertPictureInfo",produces = "application/json;charset=utf-8")
    public AjaxResult insertPictureInfo(@RequestBody PictureInfo pictureInfo)
    {
        return resourcesService.insertPictureInfo(pictureInfo);
    }

    /*
     * @==============History===============<br/>;
     * @Description //   更新首页图片资源信息
     * @Date 2025/3/14
     * @Author < a href="chencheng@prmt.net">chen</ a>;
     */
    @PostMapping(value = "/updatePictureInfo",produces = "application/json;charset=utf-8")
    public AjaxResult updatePictureInfo(@RequestBody PictureInfo pictureInfo)
    {
        return resourcesService.updatePictureInfo(pictureInfo);
    }


    /*
     * @==============History===============<br/>;
     * @Description //   获取首页图片资源列表
     * @Date 2025/3/14
     * @Author < a href="chencheng@prmt.net">chen</ a>;
     */
    @GetMapping(value = "/getPictureInfoList",produces = "application/json;charset=utf-8")
    public TableDataInfo getPictureInfoList(@RequestParam Map<String, Object> params)
    {
        startPage();
        List<PictureInfo> list = resourcesService.getPictureInfoList(params);
        return getDataTable(list);
    }

}
